package com.hd123.rumba.gwt.widget.client.grid;

import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Widget;


public class CheckBoxRendererFactory extends CellRendererFactory {
  public CellRenderer render(final DxGrid grid, final int row, final int col, String text, String width,
      boolean readOnly, boolean selected) {
    final CheckBoxRenderer widget = new CheckBoxRenderer();
    widget.setValue(text);
    grid.setWidget(row, col, widget);
    widget.setStyleName(selected ? selectedStyleName : styleName);
    widget.setWidth(width);
    widget.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        grid.fireCellWidgetClick(grid, widget, row, col);
      }
    });
    return widget;
  }
}
